import config from './config.js'
export function get_z_list(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]

    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_z_list, qr, reconfig)
}
export function get_ac_list() {
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_z_list, qr)
}
export function post_ac_file(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      // "Content-Type": "multipart/form-data"
    },
    data
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.post_ac_file, qr, reconfig)
}
export function get_jh_list(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]

    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_jh_list, qr, reconfig)
}
export function get_user_info() {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]

    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    }
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_user_info, qr, reconfig)
}

export function get_goods_list(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]

    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_goods_list, qr, reconfig)
}

export function get_region_list(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_region_list, qr, reconfig)
}

export function created_ca(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.created_ca, qr, reconfig)
}

export function get_item_ters(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_item_ters, qr, reconfig)
}

export function get_phodetel(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_phodetel, qr, reconfig)
}
export function get_zidinyilist(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_zidinyilist, qr, reconfig)
}
export function get_phon_info(data) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.get_phon_info, qr, reconfig)
}

export function creted_poconters(data, Referer) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      "Accept": 'application/json',
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8",
      Referer,
      'x-timestamp': new Date().getTime()
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.creted_poconters, qr, reconfig)
}

export function cherk_name(data, Referer) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      "Accept": 'application/json',
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8",
      Referer,
      'x-timestamp': new Date().getTime()
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.cherk_name, qr, reconfig)
}

export function creted_program_nos(data, Referer) {
  let accid = ''
  try {
    const jsonpids = location.href
    accid = jsonpids.split('?')[1].split('&')[0].split('=')[1]
    console.log('accid', accid)
  } catch (error) {

  }
  const reconfig = {
    headers: {
      "Accept": 'application/json',
      'ACCOUNT-ID': accid,
      "Content-Type": "application/json;charset=UTF-8",
      Referer,
      'x-timestamp': new Date().getTime()
    },
    data: JSON.stringify(data)
  }
  const qr = {
    'kuaishou.ad.esp_ph': this.$cookies.get('kuaishou.ad.esp_ph')
  }
  return this.$http.post(config.kuaishou.api.creted_program_nos, qr, reconfig)
}